<h3><?php echo $this->ViewTranslater('Unternehmensbereiche'); ?></h3>
<?php if (isset($this->message)) { ?>
<p class="error"><?php echo $this->message ?></p>
<?php }?>

<?php foreach($this->departments as $departmentIndex => $department){ ?>
<div class="department" id="department-'<?php echo $departmentIndex ?>"> <!--ein unternehmensbereich mit Videos und bilder in einem div-->

    <div>

        <p class="departmentName" ><?php echo $department['bus_department_name']; ?> <!-- unternehemensbereichsname -->
        <a class="iconDelete changeDepartment" href="<?php echo $this->baseUrl('backend/department/delete/id/'.$department['bus_department_nid']); ?> " title="<?php echo $this->ViewTranslater('löschen'); ?>"></a>
        <a class="iconEdit changeDepartment" href="<?php echo $this->baseUrl('backend/department/edit/id/'.$department['bus_department_nid']); ?> " title="<?php echo $this->ViewTranslater('ändern'); ?>"></a></p>

    </div>

    <div id="accordion1-<?php echo $department['bus_department_nid']; ?>"> <!-- erste akkordeon ebene (videos und bilder) -->

        <a class="departmentVideos"><?php echo $this->ViewTranslater('VIDEOS'); ?><span class="bearb"><?php echo $this->ViewTranslater('Zuletzt bearbeitet'); ?></span><span class="anz"><?php echo $this->ViewTranslater('Anzahl'); ?></span></a> <!-- unterordner von erster akkordeonebene -->
        <!-- ////////////videoordner////////////////// -->
        <div>

            <div id="accordion11-<?php echo $department['bus_department_nid']; ?>" class="innerContent"> <!-- zweite akkordeon ebene (videounterordner) -->

            <?php if(isset($department['videoCats'])){ ?>
            <?php $number = 1;//fuer nummerierung der unterkategorien ?>
            <?php foreach($department['videoCats'] as $videoCatIndex => $videoCat){ ?>
                <a class="iconEdit changeVideocategory iconEditFirst" href="<?php echo $this->baseUrl('backend/video-cat/edit/id/'.$videoCat['vid_category_nid']); ?>" title="<?php echo $this->ViewTranslater('Videokategorie ändern'); ?>"></a>

                <a class="departmanetCategoryName <?php echo $this->cycle(array("even", "odd"))->next(); ?>"><span class="number"><?php echo $number++; ?>.</span><span class="innertext"><?php echo $videoCat['vid_cat2lang_name']; ?></span> <span class="bearb">04.07.2012</span><span class="anz"><?php echo $videoCat['videos']['sum']; ?> <?php echo $this->ViewTranslater('Clips');?></span></a>
                <div>
                <?php if(isset($videoCat['videos'])){ ?>
                <?php foreach($videoCat['videos'] as $videoIndex => $video){ ?>
                    <p class="videotext"><?php echo $video['vid_video2lang_name']; ?>
                    <a class="iconEdit changeVideocategory <?php echo $this->cycle(array("even", "odd"))->next(); ?>" href="<?php echo $this->baseUrl('backend/video/edit/id/'.$video['video_nid']); ?>" title="<?php echo $this->ViewTranslater('Video ändern'); ?>"></a></p>
                <?php } ?>
                <?php } ?>
                    <a class="newVideo" href="<?php echo $this->baseUrl('backend/video/add/id/'.$videoCat['vid_category_nid']); ?>"><?php echo $this->ViewTranslater('neues Video hinzufügen');?></a>
                </div>
                <?php } ?>
            <?php } ?>

            </div>

            <a class="newVideoOrdner" href="<?php echo $this->baseUrl('backend/video-cat/add/id/'.$department['bus_department_nid']); ?>"><?php echo $this->ViewTranslater('neuen videordner hinzufügen'); ?></a>

        </div>
    </div>
    <!-- ////////////videoordner ende////////////////// -->

</div>
<?php } ?>
<a class="adddepartment" href="<?php echo $this->baseUrl('backend/department/add'); ?>" ><?php echo $this->viewTranslater('addDepartment') ?></a>


<script type="text/javascript">
    jQuery(document).ready(function(){
        $("[id^=accordion1-]").accordion({
            header: '.departmentVideos',
            active: false,
            alwaysOpen: false,
            //animated: false,
            autoHeight: false
        });
    });
    jQuery(document).ready(function(){
        $("[id^=accordion11-]").accordion({
            header: '.departmanetCategoryName',
            active: false,
            alwaysOpen: false,
            //animated: false,
            autoHeight: false
        });
    });
</script>